#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int missingNumber1(int* nums, int numsSize)
{
    int ret = 0;
    for (int i = 0; i < numsSize; i++)
    {
        ret ^= nums[i];
        ret ^= i;
    }
    ret ^= numsSize;
    return ret;
}

int missingNumber(int* nums, int numsSize)
{
    int ret = ((numsSize) * (numsSize + 1)) / 2;
    for (int i = 0; i < numsSize; i++)
    {
        ret -= nums[i];
    }
    return ret;
}

int main()
{
	int arr[] = { 3, 0, 1 };
    printf("%d", missingNumber(arr,3));
	return 0;
}
